home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1989 September
/
1989-09.d64
/
block battle
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
6KB
|
169 lines
5 rem copyright 1989 compute! publications, inc. - all rights reserved
10 goto1310
20 w=.:gf=w:yf=w:forz=wto5:ifp(z,7)=1thengf=gf+1
30 ifp(z,.)=2thenyf=yf+1
40 next:ifgf=6oryf=6thenw=p:return
50 ifgt=.andyt=.thenw=3:return
60 ifgt=.thenw=2:return
70 ifyt=.thenw=1:return
80 ifgf>=yfandgf>ytthenw=1:return
90 ifyf>=gfandyf>gtthenw=2:return
100 ifgf=yfandgt=yt andgf=gtthenw=3
110 return
120 poke646,19-p*6
130 l=len(m$):j=38-l/2:k=l-19:fori=1tok:poke214,22:print
140 printspc(j)left$(m$,i)right$(m$,l-(l-i)):j=j-1:next:return
150 pokev+41,1:gosub290:ife=1or(peek(56322-p)and16)=.goto210
160 ifx<.orx>7thenx=-7*(x<.)
170 ify<.ory>5theny=-5*(y<0)
180 ifx>5thenpokev+16,4:pokev+4,x*40-224:goto200
190 pokev+16,.:pokev+4,x*40+32
200 pokev+5,y*32+58:pokev+21,4:goto150
210 ifq=1andp(y,x)<>pthenr=1:goto280
220 ifq=2and(x=.orx=7)goto 150
230 m$=" indicate a direction ":gosub120:a=x:b=y
240 gosub290:ifx=aandy=bgoto240
250 ifq=2goto280
260 ifx<.orx>7thenx=-7*(x>7)
270 ify<.ory>5theny=-5*(y>5)
280 pokev+21,.:return
290 jy=peek(56322-p)and15:g=peek(653):e=peek(197)
300 x=x+(jy=11)-(jy=7)+(g=1ande=2)-(g=.ande=2)
310 y=y+(jy=14)-(jy=13)+(g=1ande=7)-(g=.ande=7):return
320 d=32:ifr(b,a)=1thend=160
330 ifb(b,a)=1thend=224
340 gosub350:return
350 z=49193:goto 370
360 z=55337
370 f=z+a*5+b*160
380 pokef,d:pokef+1,d:pokef+2,d:pokef+40,d:pokef+41,d:pokef+42,d:return
390 f=49193+x*5+y*160:pokef,99:pokef+1,100:pokef+2,101:pokef+40,102
400 pokef+41,103:pokef+42,104:return
410 r=.:ifx<.orx>7ory<.ory>5thenr=1:return
420 ifxandx<>7andp(y,x)>.thenr=1:return
430 ifx=.andp=1andp(y,x)>.thenr=1
440 ifx=.andp=2andp(y,x)=2thenr=1
450 ifx=7andp=1andp(y,x)=1thenr=1
460 ifx=7andp=2andp(y,x)>.thenr=1
470 iftr>1andxandx<>7andb(y,x)=.andr(y,x)=.thenr=1
480 iftr>1thenreturn
490 ifxandx<>7and(b(y,x)=.orr(y,x)=.)thenr=1
500 return
510 p=2+(p=2):ifp=1orc<>1goto700
520 m$=" the computer moves ":gosub120:tr=1
530 a=.:b=-1:iftr>2thena=int(6*rnd(1))
540 b=b+1:ifb>5thenb=.:a=a+1
550 ifa>7thentr=tr+1:goto530
560 ifp(b,a)<2goto 540
570 x=a:y=b:ifa=.theny=-1:goto640
580 y=b:x=a-1:gosub410:if r=.goto 690
590 iftr<3goto540
600 y=b-1:x=a:gosub410:ifr=.goto690
610 y=b+1:gosub410:ifr=.goto690
620 iftr<4goto680
630 y=b:x=x+1:gosub410:onr+1goto690,540
640 y=y+1:ify>5goto580
650 onp(y,x)+1goto640,660,640
660 ify>btheny=b+1:goto680
670 y=b-1
680 gosub410:onrgoto540
690 tr=1:goto720
700 m$=" choose a block ":gosub120:q=1:y=1:x=(p-1)*7:r=.
710 gosub150:onrgoto700
720 tr=2:gosub410:onrgoto700
730 if p(y,x)=.goto760
740 ifp=1thenyt=yt-1:goto760
750 gt=gt-1
760 pokev+39,19-p*6:pokev+40,11
770 ifa>5thenpokev+16,3:pokev,a*40-224:pokev+2,a*40-224:goto790
780 pokev+16,.:pokev,a*40+32:pokev+2,a*40+32
790 pokev+1,b*32+58:pokev+3,b*32+58:pokev+21,3:ifaanda<>7thengosub320:goto810
800 d=106:gosub350:d=12:gosub360
810 p(b,a)=.:p(y,x)=p:i=a*40+32:k=b*32+58:forz=1to8
820 o=i+z*5*(x-a):if o>255 then poke v+16,3:pokev,o-256:pokev+2,o-256:goto840
830 pokev+16,.:pokev,o:pokev+2,o
840 o=k+z*4*(y-b):pokev+1,o:pokev+3,o:next
850 gosub390:d=19-p*6:f=f+6144:gosub380:pokev+21,.:gosub20:ifwgoto1250
860 ifp=1orc<>1goto1100
870 a=6:b=-1
880 b=b+1:ifb>5thenb=.:a=a-1
890 ifa=.goto1030
900 ifp(b,a)<>1goto880
910 ifb(b,a)>.andr(b,a)>.goto880
920 onr(b,a)goto980
930 y=b:x=a-1:if x<1 then x=6
940 ifb(y,x)=.thenx=a+1:goto1110
950 x=a+1:if x>6 then x=1
960 ifb(y,x)=.thenx=a-1:goto1110
970 goto880
980 y=b+1:x=a:ify>5theny=.
990 ifr(y,x)=.theny=b+1:goto1110
1000 y=b-1:ify<.theny=5
1010 ifr(y,x)=.theny=b-1:goto1110
1020 goto880
1030 a=2:b=-1
1040 b=b+1:ifb>5thenb=.:a=a+1
1050 ifa>7goto1090
1060 ifp(b,a)<2goto1040
1070 ifb(b,a-1)>.orr(b,a-1)>.goto1040
1080 a=a-1:x=a:y=b+1:goto1110
1090 a=2:b=5:x=1:y=b:goto1110
1100 m$=" choose a strip ":gosub120:q=2:gosub150
1110 u=x-a:t=y-b:h=1:ifu=.thenh=.:goto1150
1120 ifu=1goto1140
1130 z=b(b,1):fora=1to5:b(b,a)=b(b,a+1):next:b(b,6)=z:goto1180
1140 z=b(b,6):fora=6to2step-1:b(b,a)=b(b,a-1):next:b(b,1)=z:goto1180
1150 ift=1goto1170
1160 z=r(.,a):forb=.to4:r(b,a)=r(b+1,a):next:r(5,a)=z:goto1180
1170 z=r(5,a):forb=5to1step-1:r(b,a)=r(b-1,a):next:r(.,a)=z
1180 forn=htoh+5:ifu=.thenb=n:goto1200
1190 a=n
1200 ifp(b,a)=.thengosub320:goto1240
1210 ifb(b,a)>.orr(b,a)>.goto1240
1220 d=32:gosub350:for z=8to72:poke53270,z:next
1230 gt=gt+(p(b,a)=1):yt=yt+(p(b,a)=2):p(b,a)=.
1240 next:gosub20:ifw=.goto510
1250 print"":onwgoto1270,1280
1260 m$=" tie game! ":goto1300
1270 m$=" green player wins! ":goto1300
1280 ifc=2thenm$=" yellow player wins! ":goto1300
1290 m$=" the computer wins! "
1300 gosub130:poke198,.:wait198,1:p=w:goto1500
1310 printchr$(142)chr$(8):x=rnd(-ti)
1320 poke781,9:poke782,1:poke90,.:poke91,216:poke88,.:poke89,248:poke56333,127
1330 poke1,51:sys41964:poke1,55:poke56333,129:poke56578,peek(56578)or3
1340 poke56576,peek(56576)and252:poke53272,peek(53272)and15:poke648,192
1350 poke53272,(peek(53272)and240)or12:print"[147]"
1360 m$="[158] one moment please... ":gosub120
1370 data255,255,255,255,245,250,245,250,255,255,255,255,85,170,85,170,255,254
1380 data252,248,80,160,80,160,245,250,245,250,240,224,192,128,85,170,85,170,,,
1390 data,80,160,80,160,,,,,245,250,245,250,245,250,245,250,85,170,85,170,85
1400 data170,85,170,80,160,80,160,80,160,80,160,255,255,255,128,,1,128,24,1,128
1410 data60,1,128,126,1,132,24,33,140,24,49,159,255,249,159,255,249,140,24,49
1420 data132,24,33,128,126,1,128,60,1,128,24,1,128,,1,255,255,255,,,,,,,,,,,,,
1430 data,,,255,255,255,255,255,254,255,255,252,255,255,248,245,85,80,250,170
1440 data160,245,85,80,250,170,160,245,85,80,250,170,160,245,85,80,250,170,160
1450 data240,,,224,,,192,,,128,,,,,,,,,,,,,,,,,,
1460 fora=.to71:readb:poke61720+a,b:next:forx=.to126:ready:poke62080+x,y:next
1470 forgf=.to47:poke62208+gf,255:next:foryf=.to14:poke62256+yf,.:next
1480 poke50168,203:poke50169,204:poke50170,202:a$="[163][164][164][164][165]":b$="[169] [171]":c$="[166][167][167][167][168]"
1490 g$="[169][170][170][170][171]":v=53248:p=2
1500 fora=.to7:forb=.to5:r(b,a)=.:b(b,a)=.:p(b,a)=.:next:next
1510 poke53280,.:poke53281,.:poke53282,11:poke53284,6:poke53265,peek(53265)or64
1520 gt=6:yt=6:print"[147][145][145]";:forq=1to6:print"[152]"a$""a$a$a$a$a$a$"[152]"a$;
1530 printg$""b$b$b$b$b$b$"[152]"g$;:printg$""b$b$b$b$b$b$"[152]"g$;
1540 printc$""c$c$c$c$c$c$"[152]"c$;:next:forq=1to2:x=.:d=13:ifq=2thenx=7:d=7
1550 a=x:fory=.to5:p(y,x)=q:gosub390:b=y:gosub360:next:next:forx=1to6:c=.
1560 y=int(6*rnd(1)):onr(y,x)goto1560
1570 r(y,x)=1:a=x:b=y:d=160:gosub350:c=c+1:ifc<4goto1560
1580 next:fory=.to5:c=.
1590 x=int(6*rnd(1))+1:ifb(y,x)=1goto1590
1600 b(y,x)=1:a=x:b=y:d=224:gosub350:c=c+1:ifc<3goto1590
1610 next:print"":m$=" block battle! ":gosub130
1620 gosub1670:m$=" copyright 1989 compute! ":gosub130:gosub1670
1630 m$=" all rights reserved ":gosub130:gosub1670
1640 m$=" [1] or [2] players? ":gosub130
1650 poke198,0:wait198,1:getk$:c=val(k$):ifc<1orc>2goto1650
1660 goto510
1670 forz=1to1500:next:return